package com.ttuproject.ttu.controller;

import com.ttuproject.ttu.advice.ResponseEnvelope;
import com.ttuproject.ttu.exception.Advice;
import com.ttuproject.ttu.service.WaringService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName WaringController
 * @Description TODO
 * @Author cw
 * @Date 2021/12/17 14:08
 */
@RestController
public class WaringController {
    @Autowired
    WaringService waringService;

    //@RequestMapping("/insert/war")
    @GetMapping("/insert/war")
    public ResponseEntity<ResponseEnvelope<Boolean>> insertWaring(@RequestParam("warNumber") String warNumber, @RequestParam("result") String result) {
        return ResponseEntity.ok(new ResponseEnvelope<>(Advice.INSERT_WAR_SUCCESS, waringService.insertWaring(warNumber, result)));
    }

}
